home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / cnet / Scratch.lha / Scratch < prev    next >
Text File  |  1996-12-21  |  13KB  |  504 lines

  1. /*************************************************************************/
  2. /*                       Scratch v1.0  by Morpheus                       */
  3. /*        This door is a conversion of the E! door ScratchE! v1.1        */
  4. /*************************************************************************/
  5. options results
  6. /*************************************************************************/
  7. /* chance : the chance to win a game                                     */
  8. /* gain   : the gain-factor                                              */
  9. /*************************************************************************/
  10. chance=5
  11. gain=3
  12. /********************************* Script ********************************/
  13. se=sendstring
  14. tr=transmit
  15. gc=getchar
  16. gu=getuser
  17. pu=putuser
  18. bbsidentify name
  19. bbsname=result
  20. bbsidentify term
  21. maxlines=word(result,2)
  22. if maxlines<30 then setlength 30
  23. gu 7
  24. starttijd=result%10
  25. gu 35
  26. startbyte=result
  27. gu 34
  28. startfile=result
  29. sp1='           '
  30. sp2='         '
  31. b.1='ÉÍÍ     ÍÍ»'
  32. b.2='º'
  33. b.3=' '
  34. b.4='º'
  35. b.5='ÈÍÍ     Íͼz0'
  36. s.1.1='         '
  37. s.1.2='    1    '
  38. s.1.3='         '
  39. s.2.1='         '
  40. s.2.2='  2   2  '
  41. s.2.3='         '
  42. s.3.1=' 3       '
  43. s.3.2='    3    '
  44. s.3.3='       3 '
  45. s.4.1='  4   4  '
  46. s.4.2='         '
  47. s.4.3='  4   4  '
  48. s.5.1=' 5     5 '
  49. s.5.2='    5    '
  50. s.5.3=' 5     5 '
  51. s.6.1=' 6  6  6 '
  52. s.6.2='         '
  53. s.6.3=' 6  6  6 '
  54. right=50;left=22;top=10;bot=16
  55. call instr
  56. call changegame
  57. quit=0
  58. cg=0
  59. do while quit=0
  60. call init_lot
  61. call draw_lot
  62. call place_bet
  63. if cg=0 then;do
  64. se apos(29,34)||'k1 S C R A T C Hk0'
  65. call get_input
  66. call win_or_lose
  67. end
  68. else cg=0
  69. end
  70. call exitscratche
  71. init_lot:
  72. win=0
  73. i=rnd(chance)
  74. if i=0 then
  75. do
  76. do j=1 for 6
  77. sym.j=0
  78. end
  79. win=1
  80. winsym=rnd(6)+1
  81. j=1
  82. do while j~=4
  83. k=rnd(6)+1
  84. if sym.k=0 then;do
  85. sym.k=winsym
  86. j=j+1
  87. end
  88. end
  89. do j=1 for 6
  90. if sym.j=0 then;do
  91. k=rnd(6)+1
  92. sym.j=k
  93. end
  94. end
  95. end
  96. else
  97. do
  98. tst='0000000000000000'
  99. j=1
  100. do while j~=7
  101. i=rnd(12)+1
  102. if substr(tst,i,1)='0' then
  103. do
  104. tst=overlay('1',tst,i)
  105. if i>6 then i=i-6
  106. sym.j=i
  107. j=j+1
  108. end
  109. end
  110. end
  111. return
  112. draw_lot:
  113. tr 'f1@6c4'
  114. tr center('ÚÄÄÄÄÄ¿ÚÄÄÄÄÄ¿ÚÄÄÄÄÄÄ¿ÚÄÄÄÄÄÄ¿ÚÄÄÄÄÄ¿ÚÄÄÄÄÄ¿ÚÄ¿ ÚÄ¿ÚÄÄÄÄÄ¿ÚÄ¿',78)
  115. tr center('³ÿÚÄÄÄÙ³ÿÚÄ¿ÿ³³ÿÚÄÄ¿ÿ³³ÿÚÄÄ¿ÿ³ÀÄ¿ÿÚÄÙ³ÿÚÄ¿ÿ³³ÿ³ ³ÿ³³ÿÚÄÄÄÙ³ÿ³',78)
  116. tr center('³ÿÀÄÄÄ¿³ÿ³ ÀÄÙ³ÿÀÄÄÙÿ³³ÿÀÄÄÙÿ³  ³ÿ³  ³ÿ³ ÀÄÙ³ÿÀÄÙÿ³³ÿÀÄ¿  ³ÿ³',78)
  117. tr center('ÀÄÄÄ¿ÿ³³ÿ³ ÚÄ¿³ÿÚÄ¿ÿÚÙ³ÿÚÄÄ¿ÿ³  ³ÿ³  ³ÿ³ ÚÄ¿³ÿÚÄ¿ÿ³³ÿÚÄÙ  ÀÄÙ',78)
  118. tr center('ÚÄÄÄÙÿ³³ÿÀÄÙÿ³³ÿ³ ³ÿÀ¿³ÿ³  ³ÿ³  ³ÿ³  ³ÿÀÄÙÿ³³ÿ³ ³ÿ³³ÿÀÄÄÄ¿ÚÄ¿',78)
  119. tr center('ÀÄÄÄÄÄÙÀÄÄÄÄÄÙÀÄÙ ÀÄÄÙÀÄÙ  ÀÄÙ  ÀÄÙ  ÀÄÄÄÄÄÙÀÄÙ ÀÄÙÀÄÄÄÄÄÙÀÄÙ',78)
  120. se apos(9,20)||'c3z4ÉÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍ»'
  121. se apos(10,20)||'º             º             º             º'
  122. se apos(11,20)||'º             º             º             º'
  123. se apos(12,20)||'º             º             º             º'
  124. se apos(13,20)||'º             º             º             º'
  125. se apos(14,20)||'º             º             º             º'
  126. se apos(15,20)||'ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍ͹'
  127. se apos(16,20)||'º             º             º             º'
  128. se apos(17,20)||'º             º             º             º'
  129. se apos(18,20)||'º             º             º             º'
  130. se apos(19,20)||'º             º             º             º'
  131. se apos(20,20)||'º             º             º             º'
  132. se apos(21,20)||'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍͼ'
  133. se apos(11,5)||'c6z0WRITTEN BY'
  134. se apos(13,6)||'MORPHEUS'
  135. select
  136. when gametype='1' then;do
  137. typetext='  EXTRA TIME'
  138. gu 7
  139. lefttext='Time left: '||result%10||' min.'
  140. end
  141. when gametype='2' then;do
  142. typetext=' EXTRA BYTES'
  143. gu 35
  144. lefttext='Bytes left: '||result||' credits'
  145. end
  146. when gametype='3' then;do
  147. typetext=' EXTRA FILES'
  148. gu 34
  149. lefttext='Files left: '||result||' credits'
  150. end
  151. when gametype='4' then typetext='     FUN!'
  152. end
  153. if gametype~='4' then se apos(22,0)||'c6'||center(lefttext,81)
  154. se apos(11,69)||'6 PLAY FOR'||apos(13,66)||typetext
  155. se apos(24,5)||'c4[c3Qc4]c3 = QUIT   c4[c3ENTERc4]c3 = SCRATCH   c4[c3Cc4]c3 = CHANGE GAME   CURSORKEYS TO SELECT'
  156. return
  157. place_bet:
  158. call check_carrier
  159. select
  160. when gametype='1' then;do forever
  161. se apos(26,26)||'c6Place your bet c1[c60-15 min.c1]c6 :c7 1 '||apos(26,55)
  162. prompt 2 NORMAL '""'
  163. inzet=upper(result)
  164. if inzet='Q' then call exitscratche
  165. if inzet='C' then;do
  166. cg=1
  167. call changegame
  168. return
  169. end
  170. if inzet='' then;do
  171. inzet=1
  172. se apos(26,55)||'c11'
  173. end
  174. if inzet>=0&inzet<16 then;do
  175. gu 7
  176. if result%10>inzet then return
  177. end
  178. end
  179. when gametype='2' then;do forever
  180. se apos(26,23)||'c6Place your bet c1[c60-250 byte cr.c1]c6 :c7 1  '||apos(26,57)
  181. prompt 3 NORMAL '""'
  182. inzet=upper(result)
  183. if inzet='Q' then call exitscratche
  184. if inzet='C' then;do
  185. cg=1
  186. call changegame
  187. return
  188. end
  189. if inzet='' then;do
  190. inzet=1
  191. se apos(26,57)||'c11'
  192. end
  193. if inzet>=0&inzet<251 then;do
  194. gu 35
  195. if result>inzet then return
  196. end
  197. end
  198. when gametype='3' then;do forever
  199. se apos(26,24)||'c6Place your bet c1[c60-10 file cr.c1]c6 :c7 1 '||apos(26,57)
  200. prompt 2 NORMAL '""'
  201. inzet=upper(result)
  202. if inzet='Q' then call exitscratche
  203. if inzet='C' then;do
  204. cg=1
  205. call changegame
  206. return
  207. end
  208. if inzet='' then;do
  209. inzet=1
  210. se apos(26,57)||'c11'
  211. end
  212. if inzet>=0&inzet<11 then;do
  213. gu 34
  214. if result>inzet then return
  215. end
  216. end
  217. otherwise nop
  218. end
  219. return
  220. get_input:
  221. x=22;y=10
  222. se apos(y,x)||b.1||apos(y+1,x)||b.2||apos(y+2,x)||b.3||apos(y+3,x)||b.4||apos(y+4,x)||b.5
  223. se apos(24,79)
  224. einde=0
  225. chang=0
  226. niets=0
  227. tel=0
  228. do k=1 for 6
  229. vak.k=0
  230. end
  231. k=1
  232. do forever
  233. call check_carrier
  234. gc
  235. key=result
  236. if key='1B'x then;do
  237. checkio
  238. if result='1' then;do
  239. gc;gc
  240. key=result
  241. if key='A' then key='8'
  242. if key='B' then key='2'
  243. if key='C' then key='6'
  244. if key='D' then key='4'
  245. end
  246. else quit=1
  247. end
  248. else if key='D'x|key='5'|key=' ' then key='0'
  249. oldx=x
  250. oldy=y
  251. select
  252. when upper(key)='Q' then quit=1
  253. when upper(key)='C' then;do
  254. call changegame
  255. chang=1
  256. se apos(24,79)
  257. return
  258. end
  259. when key='2'&y<bot then y=y+6
  260. when key='4'&x>left then x=x-14
  261. when key='6'&x<right then x=x+14
  262. when key='8'&y>top then y=y-6
  263. when key='0' then;do
  264. niets=1
  265. i=sym.k
  266. if vak.k=0 then tel=tel+1
  267. vak.k=sym.k
  268. se apos(y+1,x+1)||s.i.1||apos(y+2,x+1)||s.i.2||apos(y+3,x+1)||s.i.3
  269. se apos(24,79)
  270. end
  271. otherwise niets=1
  272. end
  273. oldk=k
  274. select
  275. when x=22&y=10 then k=1
  276. when x=22&y=16 then k=2
  277. when x=36&y=10 then k=3
  278. when x=36&y=16 then k=4
  279. when x=50&y=10 then k=5
  280. when x=50&y=16 then k=6
  281. end
  282. if niets=0&quit=0 then;do
  283. if vak.oldk=0 then
  284. se ''||apos(oldy,oldx)||sp1||apos(oldy+1,oldx)||sp1||apos(oldy+2,oldx)||sp1||apos(oldy+3,oldx)||sp1||apos(oldy+4,oldx)||sp1||'z0'
  285. else;do
  286. i=vak.oldk
  287. se ''||apos(oldy,oldx)||sp1||apos(oldy+1,oldx)||' '||s.i.1||' '||apos(oldy+2,oldx)||' '||s.i.2||' '||apos(oldy+3,oldx)||' '||s.i.3||' '||apos(oldy+4,oldx)||sp1||'z0'
  288. end
  289. if vak.k=0 then
  290. se apos(y,x)||b.1||apos(y+1,x)||b.2||sp2||b.2||apos(y+2,x)||b.3||sp2||b.3||apos(y+3,x)||b.4||sp2||b.4||apos(y+4,x)||b.5
  291. else;do
  292. i=vak.k
  293. se apos(y,x)||b.1||apos(y+1,x)||b.2||apos(y+1,x+10)||b.2||apos(y+2,x)||b.3||apos(y+2,x+10)||b.3||apos(y+3,x)||b.4||apos(y+3,x+10)||b.4||apos(y+4,x)||b.5
  294. end
  295. se apos(24,79)
  296. end
  297. else niets=0
  298. if tel=6|quit=1 then return
  299. end
  300. win_or_lose:
  301. if quit=0&chang=0 then;do
  302. i=vak.k
  303. se ''||apos(oldy,oldx)||sp1||apos(oldy+1,oldx)||' '||s.i.1||' '||apos(oldy+2,oldx)||' '||s.i.2||' '||apos(oldy+3,oldx)||' '||s.i.3||' '||apos(oldy+4,oldx)||sp1||'z0'
  304. call clr(25)
  305. select
  306. when gametype='1' then;do
  307. if win=1 then;do
  308. gu 7
  309. tijd=result%10
  310. setobject (tijd+(gain*inzet))*10
  311. pu 7
  312. se apos(25,26)||'q1k1C O N G R A T U L A T I O N S !!!k0'
  313. se apos(26,23)||'k1Y O U  H A V E  W O N  '||gain*inzet||'  M I N U T E Sk0'
  314. se apos(27,30)||'k1  E X T R A  T I M E !!!k0'
  315. end
  316. else;do
  317. gu 7
  318. tijd=result%10
  319. setobject (tijd-inzet)*10
  320. pu 7
  321. if inzet=1 then eenh='  M I N U T E'
  322. else eenh='  M I N U T E S'
  323. se apos(26,19)||'q1c7Y O U  H A V E  L O S T  '||inzet||eenh||' !!!'
  324. end
  325. end
  326. when gametype='2' then;do
  327. if win=1 then;do
  328. gu 35
  329. setobject result+(gain*inzet)
  330. pu 35
  331. se apos(25,26)||'q1k1C O N G R A T U L A T I O N S !!!k0'
  332. se apos(26,30)||'k1Y O U  H A V E  W O N  '||gain*inzet||'k0'
  333. se apos(27,28)||'k1  B Y T E  C R E D I T S !!!k0'
  334. end
  335. else;do
  336. gu 35
  337. setobject result-inzet
  338. pu 35
  339. if inzet=1 then eenh='  C R E D I T'
  340. else eenh='  C R E D I T S'
  341. se apos(26,15)||'q1c7Y O U  H A V E  L O S T  '||inzet||'  B Y T E'||eenh||' !!!'
  342. end
  343. end
  344. when gametype='3' then;do
  345. if win=1 then;do
  346. gu 34
  347. setobject result+(gain*inzet)
  348. pu 34
  349. se apos(25,26)||'q1k1C O N G R A T U L A T I O N S !!!k0'
  350. se apos(26,31)||'k1Y O U  H A V E  W O N  '||gain*inzet||'k0'
  351. se apos(27,28)||'k1  F I L E  C R E D I T S !!!k0'
  352. end
  353. else;do
  354. gu 34
  355. setobject result-inzet
  356. pu 34
  357. if inzet=1 then eenh='  C R E D I T'
  358. else eenh='  C R E D I T S'
  359. se apos(26,15)||'q1c7Y O U  H A V E  L O S T  '||inzet||'  F I L E'||eenh||' !!!'
  360. end
  361. end
  362. when gametype='4' then;do
  363. if win=1 then;do
  364. se apos(26,26)||'q1k1C O N G R A T U L A T I O N S !!!k0'
  365. se apos(27,30)||'k1Y O U  H A V E  W O N !!!k0'
  366. end
  367. else se apos(26,28)||'q1c7Y O U  H A V E  L O S T !!!'
  368. end
  369. end
  370. se apos(29,34)||'c4[c3 PRESS A KEY c4]c0'
  371. call check_carrier
  372. gc
  373. if upper(result)='Q' then call exitscratche
  374. if upper(result)='C' then call changegame
  375. se 'q1'
  376. end
  377. else if tel>1 then;do
  378. if gametype~='4' then;do
  379. gu 7
  380. tijd=result%10
  381. setobject (tijd-inzet)*10
  382. pu 7
  383. end
  384. end
  385. return
  386. changegame:
  387. err=0
  388. do forever
  389. call check_carrier
  390. call clr(25)
  391. se apos(26,14)||'c6Choose game-type (c11c6=Time, c12c6=Bytes, c13c6=Files, c14c6=Fun) : c1'||apos(26,67)
  392. prompt 1 NORMAL '""'
  393. gametype=upper(result)
  394. select
  395. when gametype='Q' then call exitscratche
  396. when gametype='1' then;do
  397. gu 7
  398. if result%10<5 then;do
  399. se apos(27,32)||'c1Not enough time left!'
  400. err=1
  401. end
  402. else return
  403. end
  404. when gametype='2' then;do
  405. gu 35
  406. if result<5 then;do
  407. se apos(27,28)||'c1Not enough byte credits left!'
  408. err=1
  409. end
  410. else return
  411. end
  412. when gametype='3' then;do
  413. gu 34
  414. if result<5 then;do
  415. se apos(27,28)||'c1Not enough file credits left!'
  416. err=1
  417. end
  418. else return
  419. end
  420. when gametype='4' then return
  421. otherwise nop
  422. end
  423. if err=1 then;do
  424. se apos(29,34)||'c4[c3 PRESS A KEY c4]c0'
  425. call check_carrier
  426. gc
  427. if upper(result)='Q' then call exitscratche
  428. se 'q1'
  429. err=0
  430. end
  431. end
  432. return
  433. exitscratche:
  434. se 'f1n3z0'
  435. gu 7
  436. stoptijd=result%10
  437. delta=stoptijd-starttijd
  438. if delta=1| delta=-1 then eenh='minute'
  439. else eenh='minutes'
  440. if delta>=0 then
  441. se 'k1'||center('You have won '||delta||' '||eenh||'!',78)||'k0n2'
  442. else se 'c7'||center('You have lost '||-delta||' '||eenh||'!',78)||'k0n2'
  443. gu 35
  444. stopbyte=result
  445. delta=stopbyte-startbyte
  446. if delta=1| delta=-1 then eenh='credit'
  447. else eenh='credits'
  448. if delta>=0 then
  449. se 'k1'||center('You have won '||delta||' byte '||eenh||'!',78)||'k0n2'
  450. else se 'c7'||center('You have lost '||-delta||' byte '||eenh||'!',78)||'k0n2'
  451. gu 34
  452. stopfile=result
  453. delta=stopfile-startfile
  454. if delta=1| delta=-1 then eenh='credit'
  455. else eenh='credits'
  456. if delta>=0 then
  457. se 'k1'||center('You have won '||delta||' file '||eenh||'!',78)||'k0n3c3'
  458. else se 'c7'||center('You have lost '||-delta||' file '||eenh||'!',78)||'k0n3c3'
  459. se center('ScratchE! v1.1  by Morpheus',78)||'c2'
  460. se apos(2,16)'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»'
  461. se apos(3,16)'º'apos(3,63)'º'apos(4,16)'º'apos(4,63)'º'apos(5,16)'º'apos(5,63)'º'apos(6,16)'º'apos(6,63)'º'apos(7,16)'º'apos(7,63)'º'apos(8,16)'º'apos(8,63)'º'apos(9,16)'º'apos(9,63)'º'
  462. se apos(10,16)'ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹'
  463. se apos(11,16)'º'apos(11,63)'º'
  464. se apos(12,16)'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼc1n2'
  465. se center('Returning to '||bbsname||'...',78)||'n1w3q1'
  466. setlength maxlines
  467. exit
  468. apos:
  469. return ''arg(1)';'arg(2)'H'
  470. printheader:
  471. se 'f1@6c6'
  472. tr center('ÛßßßßßÛ ÛßßßßßÛ ÛßßßßßßÛ ÛßßßßßßÛ ÛßßßßßÛ ÛßßßßßÛ ÛßÛ ÛßÛ ÛßßßßßÛ ÛßÛ',78)
  473. tr center('Û Ûßßßß Û ÛßÛ Û Û ÛßßÛ Û Û ÛßßÛ Û ßßÛ Ûßß Û ÛßÛ Û Û Û Û Û Û Ûßßßß Û Û',78)
  474. tr center('Û ßßßßÛ Û Û ßßß Û ßßßß Û Û ßßßß Û   Û Û   Û Û ßßß Û ßßß Û Û ßßÛ   Û Û',78)
  475. tr center('ßßßßÛ Û Û Û ÛßÛ Û ÛßÛ Ûß Û ÛßßÛ Û   Û Û   Û Û ÛßÛ Û ÛßÛ Û Û Ûßß   ßßß',78)
  476. tr center('Ûßßßß Û Û ßßß Û Û Û Û ßÛ Û Û  Û Û   Û Û   Û ßßß Û Û Û Û Û Û ßßßßÛ ÛßÛ',78)
  477. tr center('ßßßßßßß ßßßßßßß ßßß ßßßß ßßß  ßßß   ßßß   ßßßßßßß ßßß ßßß ßßßßßßß ßßß',78)
  478. se apos(7,23)||'c4-=> c3ScratchE! v1.1  by Morpheus c4<=-'
  479. return
  480. instr:
  481. call printheader
  482. tr 'n2c3  ScratchE! is a very simple doorgame especially written for Excelsior! BBS.'
  483. tr '  The aim of the game is to find at least three equal symbols/numbers in a'
  484. tr '  six-field scratch-ticket.n1'
  485. tr '  There are four different game-types:n1'
  486. tr '        c41)c3  Time  - Play for extra time'
  487. tr '        c42)c3  Bytes - Play for extra download bytes'
  488. tr '        c43)c3  Files - Play for extra download files'
  489. tr '        c44)c3  Fun   - Play for fun !!!n1'
  490. tr '  At the start of each game of the first 3 game-types you re asked to place a'
  491. tr '  bet. If you lose the game then the stake will be subtracted from your'
  492. tr '  balance. If you win the game then '||gain||' times the stake will be added to your'
  493. tr '  balance. If you quit the game with more than one field scratched open,'
  494. tr '  you ll lose!'
  495. return
  496. rnd:
  497. return (random(1,100,time(s))+random(1,100,time(s))+random(1,100,time(s)))//arg(1)
  498. clr:
  499. se ''arg(1)'H'
  500. return
  501. check_carrier:
  502. getcarrier
  503. if result='FALSE' then exit
  504. return